package qlttn.dao.daointerface;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.DriverManager;
import java.util.ResourceBundle;

/**
 * This class has method getConnect to get Connection.
 * @author Win7
 */
public class ConnectDAO {

	/**
	 * Get and return Connection.
	 * @return Connection
	 * @throws ClassNotFoundException
	 * @throws SQLException
	 */
	public static Connection getConnect() throws ClassNotFoundException,
			SQLException {
		Connection con = null;
		// Get data from properties file.
		ResourceBundle rb = ResourceBundle.getBundle("properties");
		// Load driver.
		Class.forName(rb.getString("Driver"));
		con = DriverManager.getConnection(rb.getString("Url"),
				rb.getString("Username"), rb.getString("Password"));
		return con;
	}
	
}
